package com.popo.android.fragement;

import com.popo.android.R;

import android.app.Activity;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.Button;
/**
 * zuoce dao
 * @author liboliu
 *
 */
public class LeftFrameMent extends Fragment {
	public interface LeftFrageClickListener{
		public void onClick(int postion);
	}
	
	//huidiao
	
	LeftFrageClickListener clickCallback=null;
	
	@Override
	public void onActivityCreated(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		super.onActivityCreated(savedInstanceState);
		System.out.println("Left-onActivityCreated");
	}
	
	@Override
	public View onCreateView(LayoutInflater inflater, ViewGroup container,
			Bundle savedInstanceState) {
		System.out.println("Left-OncreateView");
		// TODO Auto-generated method stub
		View view = inflater.inflate(R.layout.list, container);
		Button btn = (Button) view.findViewById(R.id.btn2);
		btn.setOnClickListener(new OnClickListener() {
			
			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				if(clickCallback !=null){
					clickCallback.onClick(0);
				}
			}
		});
		return view;
	}
	
	@Override
	public void onAttach(Activity activity) {
		// TODO Auto-generated method stub
		super.onAttach(activity);
		System.out.println("Left-onAttach");
		try{
			clickCallback = (LeftFrageClickListener) activity;
		}catch (Exception e) {
			// TODO: handle exception
			
				try {
					throw e;
				} catch (Exception e1) {
					// TODO Auto-generated catch block
					e1.printStackTrace();
				}
			
		}
	}
}
